#include <ros/ros.h>
#include <sstream>
#include "ros_test_pkg/mySrv.h"

bool service_callback(ros_test_pkg::mySrv::Request &req,
                      ros_test_pkg::mySrv::Response &res)
{
    std::stringstream ss;

    ROS_INFO("From client get:%d ,%d",req.num_a,req.num_b);
    int sum = req.num_a + req.num_b;
    ss<<"Sum is "<<sum;
    res.str = ss.str();

    return true;
}

int main(int argc,char **argv)
{
    ros::init(argc,argv,"serve_node");
    ros::NodeHandle handle;

    ros::ServiceServer service = handle.advertiseService("sum_service",service_callback);
    ROS_INFO("ready to receive data from client...");

    ros::spin();
    return 0;
}